Clover coverage report - bexee - 0.1
Coverage timestamp: Do Dez 16 2004 13:24:06 CET
file stats: LOC: 65   Methods: 1
NCLOC: 29   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
ProcessControllerFactory.java 100% 100% 100% 100%
coverage
 1   
 /*
 2   
  * $Id: ProcessControllerFactory.java,v 1.1 2004/12/15 14:18:10 patforna Exp $
 3   
  *
 4   
  * Copyright (c) 2004 Patric Fornasier, Pawel Kowalski
 5   
  * Berne University of Applied Sciences
 6   
  * School of Engineering and Information Technology
 7   
  * All rights reserved.
 8   
  */
 9   
 package bexee.core;
 10   
 
 11   
 import org.apache.commons.logging.Log;
 12   
 import org.apache.commons.logging.LogFactory;
 13   
 
 14   
 import bexee.util.BexeeProperties;
 15   
 import bexee.util.Constants;
 16   
 
 17   
 /**
 18   
  * Abstract factory class for creating <code>ProcessControllerFactory</code>
 19   
  * implementations.
 20   
  * 
 21   
  * @version $Revision: 1.1 $, $Date: 2004/12/15 14:18:10 $
 22   
  * @author Patric Fornasier
 23   
  * @author Pawel Kowalski
 24   
  */
 25   
 public class ProcessControllerFactory {
 26   
 
 27   
     private static Log log = LogFactory.getLog(ProcessControllerFactory.class);
 28   
 
 29   
     /**
 30   
      * Creates a new <code>ProcessController</code>. The actual type is
 31   
      * defined by the property <code>bexee.controller</code>.
 32   
      * <p>
 33   
      * If it is not set then {@link ProcessControllerImpl}will be created.
 34   
      * 
 35   
      * @return a <code>ProcessController</code> implementation
 36   
      */
 37  22
     public static ProcessController createProcessController() {
 38   
 
 39  22
         ProcessController controller = null;
 40   
 
 41  22
         String className = BexeeProperties
 42   
                 .getProperty(Constants.OPT_CONTROLLER);
 43   
 
 44   
         // if option is not set, create default factory
 45  22
         if (className == null) {
 46  18
             log.debug(Constants.OPT_DAO_FACTORY
 47   
                     + " not set, creating default implementation: "
 48   
                     + ProcessControllerImpl.class.getName());
 49  18
             controller = new ProcessControllerImpl();
 50   
         } else {
 51  4
             try {
 52   
                 // try to instantiate indicated class
 53  4
                 Class clazz = Class.forName(className);
 54  2
                 controller = (ProcessController) clazz.newInstance();
 55   
             } catch (Exception e) {
 56  2
                 log.warn("unable to create " + className
 57   
                         + ", creating default implementation: "
 58   
                         + ProcessControllerImpl.class.getName());
 59  2
                 controller = new ProcessControllerImpl();
 60   
             }
 61   
         }
 62   
 
 63  22
         return controller;
 64   
     }
 65   
 }